{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-08-18T10:06:42.468812Z",
     "start_time": "2025-08-18T10:06:27.042052Z"
    }
   },
   "source": [
    "from langchain_openai import ChatOpenAI\n",
    "import os\n",
    "chatLLM = ChatOpenAI(\n",
    "    # 若没有配置环境变量，请用百炼API Key将下行替换为：api_key=\"sk-xxx\",\n",
    "    api_key=os.getenv(\"DASH_SCOPE_API_KEY\"), # 如何获取API Key：https://help.aliyun.com/zh/model-studio/developer-reference/get-api-key\n",
    "    base_url=\"https://dashscope.aliyuncs.com/compatible-mode/v1\",\n",
    "    model=\"qwen-plus\",\n",
    "    temperature=0.8,\n",
    "    max_tokens=60,\n",
    ")\n",
    "\n",
    "messages = [\n",
    "    {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n",
    "    {\"role\": \"user\", \"content\": \"请给我的花店起个名\"}]\n",
    "\n",
    "\n",
    "response = chatLLM.invoke(messages)\n",
    "print(response.content)"
   ],
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "当然可以！为了帮你起一个贴合你花店风格的名字，我可以先了解一些信息：\n",
      "\n",
      "1. **花店的风格**：是走文艺清新路线？还是高端优雅路线？或者是可爱、可爱系？\n",
      "2. **主要售卖什么类型的花**？鲜花？永生花？多肉植物？还是结合花艺设计？\n",
      "3. **目标客户群**是谁？年轻人？上班族？婚礼客户？还是送礼人群？\n",
      "4. **你希望名字传达的感觉**：温馨？浪漫？小众？有诗意？还是带点个性？\n",
      "\n",
      "如果你愿意告诉我这些信息，我可以为你量身定制一些名字。\n",
      "\n",
      "---\n",
      "\n",
      "### 如果你暂时不确定，我可以先提供一些不同风格的名字供你参考：\n",
      "\n",
      "#### 🌸 文艺清新风\n",
      "- 花间一壶酒  \n",
      "- 一朵小确幸  \n",
      "- 花屿时光  \n",
      "- 春日来信  \n",
      "- 与花共语\n",
      "\n",
      "#### 🌹 浪漫优雅风\n",
      "- 花漾年华  \n",
      "- 月光花语  \n",
      "- 花影流年  \n",
      "- 初见花坊  \n",
      "- 花梦微光\n",
      "\n",
      "#### 🌿 小众自然风\n",
      "- 野花集  \n",
      "- 山花慢慢开  \n",
      "- 林间花语  \n",
      "- 花木纪事  \n",
      "- 花物所\n",
      "\n",
      "#### 💐 高端定制风\n",
      "- 花艺美学馆  \n",
      "- 花叙·高端定制  \n",
      "- 雅致花舍  \n",
      "- 花间集  \n",
      "- 拾光花艺\n",
      "\n",
      "#### 🧡 可爱俏皮风\n",
      "- 花朵朵  \n",
      "- 开心花铺  \n",
      "- 花花世界  \n",
      "- 小花匠  \n",
      "- 花朵研究所\n",
      "\n",
      "---\n",
      "\n",
      "如果你喜欢其中一个名字，我可以继续帮你延伸LOGO设计、标语（slogan）、宣传语等。  \n",
      "你也可以告诉我你喜欢的关键词，我来组合看看～\n"
     ]
    }
   ],
   "execution_count": 1
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "de0081150db97bff"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
